<script setup>
import { inject } from 'vue';

// 与eventBus是两码事
const color = inject("color")
</script>

<template>
<h2>孙组件</h2>
<div :style="{color:color}">看我的颜色</div>
</template>
